package com.langfeiyes.pattern.observer.demo2;

//观察者：消费者
public class ConsumerObserver  implements Observer{

    private String name;

    public ConsumerObserver(String name){
        this.name = name;
    }
    @Override
    public void update(Subject subject) {
        ProductObserver po = (ProductObserver) subject;
        if(po.getState()){
            System.out.println(this.name + "：心念念的"+po.getName()+"，终于到啦，抢呀~");
        }else{
            System.out.println(this.name + "小明：还没到啊，花都谢了~");
        }

    }
}
